package edu.utn.frba.procesamiento.grupo3.audio;


public class NRMediaMovilSignal {
	
	public static String NOMBRE = "Media Movil";

	public static double[] getMediaMovilSignal(double[] vecSignal) {
		double[] vecSignalFiltered = new double[vecSignal.length];
		
		vecSignalFiltered[0] =  vecSignal[0];
		
		for (int i = 1; i < vecSignal.length; i++) {
			vecSignalFiltered[i] = (vecSignal[i] + vecSignal[i-1]) / 2;
		}

		return vecSignalFiltered;
	}

	public static void main(String[] args) {

		double signal[] = { 0, 1, -2, 3, -4, 5, 6, 7 };

		double signalFiltered[] = getMediaMovilSignal(signal);
		
		for (int i = 0; i < signalFiltered.length; i++) {
			System.out.println(signalFiltered[i]);
		}

	}
}
